﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Gift.DBUtility;//Please add references
using Gift.Model;

namespace Gift.DAL
{
    /// <summary>
    /// 数据访问类:DALGroupBuy
    /// </summary>
    public partial class DALGroupBuy
    {
        public DALGroupBuy()
        { }
        #region  Method
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from tbGroupBuy");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
            parameters[0].Value = id;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Gift.Model.tbGroupBuy model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into tbGroupBuy(");
            strSql.Append("groupBuyCategory,groupBuyName,groupBuySummarized,costPrice,originalPrice,presentPrice,inventory,groupBuyNumber,isShelves,pictures,startTime,endTime,isFromFreight,freightTemplate,is7DayRefund,isExpiredRefund,remark,sortOrder,keywords,description,creator,createTime,modifyTime)");
            strSql.Append(" values (");
            strSql.Append("@groupBuyCategory,@groupBuyName,@groupBuySummarized,@costPrice,@originalPrice,@presentPrice,@inventory,@groupBuyNumber,@isShelves,@pictures,@startTime,@endTime,@isFromFreight,@freightTemplate,@is7DayRefund,@isExpiredRefund,@remark,@sortOrder,@keywords,@description,@creator,@createTime,@modifyTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@groupBuyCategory", SqlDbType.Int,4),
					new SqlParameter("@groupBuyName", SqlDbType.NVarChar,50),
					new SqlParameter("@groupBuySummarized", SqlDbType.NVarChar,500),
					new SqlParameter("@costPrice", SqlDbType.Decimal,9),
					new SqlParameter("@originalPrice", SqlDbType.Decimal,9),
					new SqlParameter("@presentPrice", SqlDbType.Decimal,9),
					new SqlParameter("@inventory", SqlDbType.Int,4),
					new SqlParameter("@groupBuyNumber", SqlDbType.Int,4),
					new SqlParameter("@isShelves", SqlDbType.Bit,1),
					new SqlParameter("@pictures", SqlDbType.NVarChar,200),
					new SqlParameter("@startTime", SqlDbType.DateTime),
					new SqlParameter("@endTime", SqlDbType.DateTime),
					new SqlParameter("@isFromFreight", SqlDbType.Bit,1),
					new SqlParameter("@freightTemplate", SqlDbType.Int,4),
					new SqlParameter("@is7DayRefund", SqlDbType.Bit,1),
					new SqlParameter("@isExpiredRefund", SqlDbType.Bit,1),
					new SqlParameter("@remark", SqlDbType.Text),
					new SqlParameter("@sortOrder", SqlDbType.Int,4),
					new SqlParameter("@keywords", SqlDbType.NVarChar,100),
					new SqlParameter("@description", SqlDbType.NVarChar,200),
					new SqlParameter("@creator", SqlDbType.Int,4),
					new SqlParameter("@createTime", SqlDbType.DateTime),
					new SqlParameter("@modifyTime", SqlDbType.DateTime)};
            parameters[0].Value = model.groupBuyCategory;
            parameters[1].Value = model.groupBuyName;
            parameters[2].Value = model.groupBuySummarized;
            parameters[3].Value = model.costPrice;
            parameters[4].Value = model.originalPrice;
            parameters[5].Value = model.presentPrice;
            parameters[6].Value = model.inventory;
            parameters[7].Value = model.groupBuyNumber;
            parameters[8].Value = model.isShelves;
            parameters[9].Value = model.pictures;
            parameters[10].Value = model.startTime;
            parameters[11].Value = model.endTime;
            parameters[12].Value = model.isFromFreight;
            parameters[13].Value = model.freightTemplate;
            parameters[14].Value = model.is7DayRefund;
            parameters[15].Value = model.isExpiredRefund;
            parameters[16].Value = model.remark;
            parameters[17].Value = model.sortOrder;
            parameters[18].Value = model.keywords;
            parameters[19].Value = model.description;
            parameters[20].Value = model.creator;
            parameters[21].Value = model.createTime;
            parameters[22].Value = model.modifyTime;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Gift.Model.tbGroupBuy model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update tbGroupBuy set ");
            strSql.Append("groupBuyCategory=@groupBuyCategory,");
            strSql.Append("groupBuyName=@groupBuyName,");
            strSql.Append("groupBuySummarized=@groupBuySummarized,");
            strSql.Append("costPrice=@costPrice,");
            strSql.Append("originalPrice=@originalPrice,");
            strSql.Append("presentPrice=@presentPrice,");
            strSql.Append("inventory=@inventory,");
            strSql.Append("groupBuyNumber=@groupBuyNumber,");
            strSql.Append("isShelves=@isShelves,");
            strSql.Append("pictures=@pictures,");
            strSql.Append("startTime=@startTime,");
            strSql.Append("endTime=@endTime,");
            strSql.Append("isFromFreight=@isFromFreight,");
            strSql.Append("freightTemplate=@freightTemplate,");
            strSql.Append("is7DayRefund=@is7DayRefund,");
            strSql.Append("isExpiredRefund=@isExpiredRefund,");
            strSql.Append("remark=@remark,");
            strSql.Append("sortOrder=@sortOrder,");
            strSql.Append("keywords=@keywords,");
            strSql.Append("description=@description,");
            strSql.Append("creator=@creator,");
            strSql.Append("createTime=@createTime,");
            strSql.Append("modifyTime=@modifyTime,");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@groupBuyCategory", SqlDbType.Int,4),
					new SqlParameter("@groupBuyName", SqlDbType.NVarChar,50),
					new SqlParameter("@groupBuySummarized", SqlDbType.NVarChar,500),
					new SqlParameter("@costPrice", SqlDbType.Decimal,9),
					new SqlParameter("@originalPrice", SqlDbType.Decimal,9),
					new SqlParameter("@presentPrice", SqlDbType.Decimal,9),
					new SqlParameter("@inventory", SqlDbType.Int,4),
					new SqlParameter("@groupBuyNumber", SqlDbType.Int,4),
					new SqlParameter("@isShelves", SqlDbType.Bit,1),
					new SqlParameter("@pictures", SqlDbType.NVarChar,200),
					new SqlParameter("@startTime", SqlDbType.DateTime),
					new SqlParameter("@endTime", SqlDbType.DateTime),
					new SqlParameter("@isFromFreight", SqlDbType.Bit,1),
					new SqlParameter("@freightTemplate", SqlDbType.Int,4),
					new SqlParameter("@is7DayRefund", SqlDbType.Bit,1),
					new SqlParameter("@isExpiredRefund", SqlDbType.Bit,1),
					new SqlParameter("@remark", SqlDbType.Text),
					new SqlParameter("@sortOrder", SqlDbType.Int,4),
					new SqlParameter("@keywords", SqlDbType.NVarChar,100),
					new SqlParameter("@description", SqlDbType.NVarChar,200),
					new SqlParameter("@creator", SqlDbType.Int,4),
					new SqlParameter("@createTime", SqlDbType.DateTime),
					new SqlParameter("@modifyTime", SqlDbType.DateTime),
					new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = model.groupBuyCategory;
            parameters[1].Value = model.groupBuyName;
            parameters[2].Value = model.groupBuySummarized;
            parameters[3].Value = model.costPrice;
            parameters[4].Value = model.originalPrice;
            parameters[5].Value = model.presentPrice;
            parameters[6].Value = model.inventory;
            parameters[7].Value = model.groupBuyNumber;
            parameters[8].Value = model.isShelves;
            parameters[9].Value = model.pictures;
            parameters[10].Value = model.startTime;
            parameters[11].Value = model.endTime;
            parameters[12].Value = model.isFromFreight;
            parameters[13].Value = model.freightTemplate;
            parameters[14].Value = model.is7DayRefund;
            parameters[15].Value = model.isExpiredRefund;
            parameters[16].Value = model.remark;
            parameters[17].Value = model.sortOrder;
            parameters[18].Value = model.keywords;
            parameters[19].Value = model.description;
            parameters[20].Value = model.creator;
            parameters[21].Value = model.createTime;
            parameters[22].Value = model.modifyTime;
            parameters[23].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from tbGroupBuy ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
            parameters[0].Value = id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string idlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from tbGroupBuy ");
            strSql.Append(" where id in (" + idlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Gift.Model.tbGroupBuy GetModel(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,groupBuyCategory,groupBuyName,groupBuySummarized,costPrice,originalPrice,presentPrice,inventory,groupBuyNumber,isShelves,pictures,startTime,endTime,isFromFreight,freightTemplate,is7DayRefund,isExpiredRefund,remark,sortOrder,keywords,description,creator,createTime,modifyTime  from tbGroupBuy ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
            parameters[0].Value = id;

            Gift.Model.tbGroupBuy model = new Gift.Model.tbGroupBuy();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["groupBuyCategory"] != null && ds.Tables[0].Rows[0]["groupBuyCategory"].ToString() != "")
                {
                    model.groupBuyCategory = int.Parse(ds.Tables[0].Rows[0]["groupBuyCategory"].ToString());
                }
                if (ds.Tables[0].Rows[0]["groupBuyName"] != null && ds.Tables[0].Rows[0]["groupBuyName"].ToString() != "")
                {
                    model.groupBuyName = ds.Tables[0].Rows[0]["groupBuyName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["groupBuySummarized"] != null && ds.Tables[0].Rows[0]["groupBuySummarized"].ToString() != "")
                {
                    model.groupBuySummarized = ds.Tables[0].Rows[0]["groupBuySummarized"].ToString();
                }
                if (ds.Tables[0].Rows[0]["costPrice"] != null && ds.Tables[0].Rows[0]["costPrice"].ToString() != "")
                {
                    model.costPrice = decimal.Parse(ds.Tables[0].Rows[0]["costPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["originalPrice"] != null && ds.Tables[0].Rows[0]["originalPrice"].ToString() != "")
                {
                    model.originalPrice = decimal.Parse(ds.Tables[0].Rows[0]["originalPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["presentPrice"] != null && ds.Tables[0].Rows[0]["presentPrice"].ToString() != "")
                {
                    model.presentPrice = decimal.Parse(ds.Tables[0].Rows[0]["presentPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["inventory"] != null && ds.Tables[0].Rows[0]["inventory"].ToString() != "")
                {
                    model.inventory = int.Parse(ds.Tables[0].Rows[0]["inventory"].ToString());
                }
                if (ds.Tables[0].Rows[0]["groupBuyNumber"] != null && ds.Tables[0].Rows[0]["groupBuyNumber"].ToString() != "")
                {
                    model.groupBuyNumber = int.Parse(ds.Tables[0].Rows[0]["groupBuyNumber"].ToString());
                }
                if (ds.Tables[0].Rows[0]["isShelves"] != null && ds.Tables[0].Rows[0]["isShelves"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["isShelves"].ToString() == "1") || (ds.Tables[0].Rows[0]["isShelves"].ToString().ToLower() == "true"))
                    {
                        model.isShelves = true;
                    }
                    else
                    {
                        model.isShelves = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["pictures"] != null && ds.Tables[0].Rows[0]["pictures"].ToString() != "")
                {
                    model.pictures = ds.Tables[0].Rows[0]["pictures"].ToString();
                }
                if (ds.Tables[0].Rows[0]["startTime"] != null && ds.Tables[0].Rows[0]["startTime"].ToString() != "")
                {
                    model.startTime = DateTime.Parse(ds.Tables[0].Rows[0]["startTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["endTime"] != null && ds.Tables[0].Rows[0]["endTime"].ToString() != "")
                {
                    model.endTime = DateTime.Parse(ds.Tables[0].Rows[0]["endTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["isFromFreight"] != null && ds.Tables[0].Rows[0]["isFromFreight"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["isFromFreight"].ToString() == "1") || (ds.Tables[0].Rows[0]["isFromFreight"].ToString().ToLower() == "true"))
                    {
                        model.isFromFreight = true;
                    }
                    else
                    {
                        model.isFromFreight = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["freightTemplate"] != null && ds.Tables[0].Rows[0]["freightTemplate"].ToString() != "")
                {
                    model.freightTemplate = int.Parse(ds.Tables[0].Rows[0]["freightTemplate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is7DayRefund"] != null && ds.Tables[0].Rows[0]["is7DayRefund"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["is7DayRefund"].ToString() == "1") || (ds.Tables[0].Rows[0]["is7DayRefund"].ToString().ToLower() == "true"))
                    {
                        model.is7DayRefund = true;
                    }
                    else
                    {
                        model.is7DayRefund = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["isExpiredRefund"] != null && ds.Tables[0].Rows[0]["isExpiredRefund"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["isExpiredRefund"].ToString() == "1") || (ds.Tables[0].Rows[0]["isExpiredRefund"].ToString().ToLower() == "true"))
                    {
                        model.isExpiredRefund = true;
                    }
                    else
                    {
                        model.isExpiredRefund = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["remark"] != null && ds.Tables[0].Rows[0]["remark"].ToString() != "")
                {
                    model.remark = ds.Tables[0].Rows[0]["remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sortOrder"] != null && ds.Tables[0].Rows[0]["sortOrder"].ToString() != "")
                {
                    model.sortOrder = int.Parse(ds.Tables[0].Rows[0]["sortOrder"].ToString());
                }
                if (ds.Tables[0].Rows[0]["keywords"] != null && ds.Tables[0].Rows[0]["keywords"].ToString() != "")
                {
                    model.keywords = ds.Tables[0].Rows[0]["keywords"].ToString();
                }
                if (ds.Tables[0].Rows[0]["description"] != null && ds.Tables[0].Rows[0]["description"].ToString() != "")
                {
                    model.description = ds.Tables[0].Rows[0]["description"].ToString();
                }
                if (ds.Tables[0].Rows[0]["creator"] != null && ds.Tables[0].Rows[0]["creator"].ToString() != "")
                {
                    model.creator = int.Parse(ds.Tables[0].Rows[0]["creator"].ToString());
                }
                if (ds.Tables[0].Rows[0]["createTime"] != null && ds.Tables[0].Rows[0]["createTime"].ToString() != "")
                {
                    model.createTime = DateTime.Parse(ds.Tables[0].Rows[0]["createTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["modifyTime"] != null && ds.Tables[0].Rows[0]["modifyTime"].ToString() != "")
                {
                    model.modifyTime = DateTime.Parse(ds.Tables[0].Rows[0]["modifyTime"].ToString());
                }
      
                return model;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,groupBuyCategory,groupBuyName,groupBuySummarized,costPrice,originalPrice,presentPrice,inventory,groupBuyNumber,isShelves,pictures,startTime,endTime,isFromFreight,freightTemplate,is7DayRefund,isExpiredRefund,remark,sortOrder,keywords,description,creator,createTime,modifyTime  ");
            strSql.Append(" FROM tbGroupBuy ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" id,groupBuyCategory,groupBuyName,groupBuySummarized,costPrice,originalPrice,presentPrice,inventory,groupBuyNumber,isShelves,pictures,startTime,endTime,isFromFreight,freightTemplate,is7DayRefund,isExpiredRefund,remark,sortOrder,keywords,description,creator,createTime,modifyTime ");
            strSql.Append(" FROM tbGroupBuy ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM tbGroupBuy ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.id desc");
            }
            strSql.Append(")AS Row, T.*  from tbGroupBuy T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }

        public DataTable GetGroupBuyByIdAndGroupBuyCategoryAndIsShelvesAndTop(int id, int cid, int isShelves, int top)
        {
            DataTable table = new DataTable();
            try
            {
                string commandText = string.Format("select top(@top) id,groupBuyCategory,groupBuySummarized,originalPrice,presentPrice,inventory,groupBuyNumber,isShelves,pictures,startTime,endTime,is7DayRefund,isExpiredRefund,remark,sortOrder,keywords,description,buyCount from view_groupBuy where id<>@id and groupBuyCategory=@groupBuyCategory and isShelves=@isShelves  order by sortOrder", new object[0]);
                SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@id", id), new SqlParameter("@groupBuyCategory", cid),  new SqlParameter("@isShelves", isShelves), new SqlParameter("@top", top) };
                table = DbHelperSQL.Query(commandText, commandParameters).Tables[0];
            }
            catch
            {
            }
            return table;
        }

        public int GetGroupBuyByIsShelves( int isShelves)
        {
            int num = 0;
            try
            {
                string commandText = string.Format("select count(*) from tbGroupBuy  and isShelves=@isShelves", new object[0]);
                SqlParameter[] commandParameters = new SqlParameter[] {  new SqlParameter("@isShelves", isShelves) };
                num = DbHelperSQL.ExecuteSql( commandText, commandParameters);
            }
            catch
            {
            }
            return num;
        }

        public DataTable GetGroupBuyIsShelvesAndTop( int isShelves, int top)
        {
            DataTable table = new DataTable();
            try
            {
                string commandText = string.Format("select top(@top) id,groupBuyCategory,groupBuyName,groupBuySummarized,originalPrice,presentPrice,inventory,groupBuyNumber,isShelves,pictures,startTime,endTime,is7DayRefund,isExpiredRefund,remark,sortOrder,keywords,description,buyCount from view_groupBuy where isShelves=@isShelves  and getdate()<endTime order by sortOrder", new object[0]);
                SqlParameter[] commandParameters = new SqlParameter[] {  new SqlParameter("@isShelves", isShelves), new SqlParameter("@top", top) };
                table = DbHelperSQL.Query(commandText, commandParameters).Tables[0];
            }
            catch
            {
            }
            return table;
        }



        public bool ModifyGroupBuyInventory(int id, int inventory)
        {
            bool flag = false;
            try
            {
                string commandText = string.Format("update tbGroupBuy set inventory=(inventory-@inventory) where id=@id", new object[0]);
                SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@id", id), new SqlParameter("@inventory", inventory) };
                if (DbHelperSQL.ExecuteSql(commandText, commandParameters) > 0)
                {
                    flag = true;
                }
            }
            catch
            {
            }
            return flag;
        }


        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "tbGroupBuy";
            parameters[1].Value = "id";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        #endregion  Method
    }
}

